import { Button } from 'antd';
import {WeaDialog ,WeaNewScroll,WeaSearchGroup,WeaLocaleProvider,WeaMap} from 'ecCom';
import {observer} from "mobx-react";
import {toJS} from 'mobx';
import {WeaTableNew,WeaSwitch} from 'comsMobx';
const WeaTable = WeaTableNew.WeaTable;
const getLabel = WeaLocaleProvider.getLabel;

@observer
class MapDialog extends React.Component {
    constructor(props) {
        super(props);
    }

    shouldComponentUpdate(nextProps,nextState){
        return true;
    }
 
    render() {
        const {store} = this.props;
        const {mapDialogVisible,position,address} = store;
        // console.log(111,position)
        return (
            <div>
            <WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@l0o0tn`}
                title={"地图"}
                visible={mapDialogVisible}
                buttons={this.getButtons()}
                icon="icon-coms-ModelingEngine"
                iconBgcolor="#217346"
                onCancel={()=>{store.setMapDialogVisible(false)}}
                style={{width:'700px', height:'400px'}}
            >
                <WeaMap ecId={`${this && this.props && this.props.ecId || ''}_WeaMap@7ctsyw`} position={toJS(position)} title={address}/>
            </WeaDialog>
        </div>)
    }

    getButtons(){
        const {store} = this.props;
        let btnArr = []; 
        btnArr.push(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@l5wzb3@cancel`}  type="primary" onClick={()=>store.setMapDialogVisible(false)}>{getLabel(309,"关闭")}</Button>)  
        return btnArr;
    }
   
}

export default MapDialog;